import { request } from '~/api/request'

const isPoliceMan = ['POLICE'].includes(JSON.parse(localStorage.getItem('u')!).roles[0])

export const queryWaitStorageCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/waitStorageCaseList', data)

export const querySelfStorageCastItems = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/waitStorageCaseItems', data)

export const queryCenterStorageCastItems = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/waitCenterStorageCaseItems', data)

export const queryCastItems = (data: any): any => request('post', '/api/internal/v1/item/manage/query/castItems', data)

export const queryWaitCenterStorageCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/waitCenterStorageCaseList', data)

export const queryApproveWaitBorrowCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/borrow/query/approveWaitBorrowCaseList', data)

export const queryBorrowCastItems = (data: any): any =>
  request('post', '/api/internal/v1/item/borrow/query/castItems', data)

export const queryBorrowedLists = (data: any): any =>
  request('post', `/api/internal/v1/item/borrow/query/${isPoliceMan ? 'borrowCaseList' : 'borrowOutCaseList'}`, data)

export const queryCenterStorageCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/centerStorageCaseList', data)

export const queryStorageCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/special/storageCaseList', data)

export const queryStorageCastItems = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/query/storageCastItems', data)

export const queryTakeCaseList = (data: any): any =>
  request('post', '/api/internal/v1/item/take/query/takeCaseList', data)

export const confirmBorrow = (data: any): any => request('post', '/api/internal/v1/item/manage/confirmBorrow', data)

export const handleStorage = (data: any): any => request('post', '/api/internal/v1/item/manage/special/storage', data)

export const handleCenterStorage = (data: any): any =>
  request('post', '/api/internal/v1/item/manage/special/centerStorage', data)

export const handleUpdateStoreLocation = (data: any): any =>
  request('post', '/api/internal/v1/item/opt/updateStoreLocation', data)

export const handleUpdateStoreLocationPics = (data: any): any =>
  request('post', '/api/internal/v1/item/opt/updateStoreLocationPics', data)
